Skip to content

Add per-particle neighbor loop (NoShifting / NoKernelOutput)#155

Open
AhmedSalih3d wants to merge 1 commit intomainfrom
codex/optimize-particle-interaction-loop
Open

Add per-particle neighbor loop (NoShifting / NoKernelOutput)#155
AhmedSalih3d wants to merge 1 commit intomainfrom
codex/optimize-particle-interaction-loop

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Avoid cross-thread writes and reduce overhead when kernel output and shifting are disabled by iterating per particle with per-thread accumulators.
  • Provide a lighter-weight interaction path that skips kernel recording and shifting bookkeeping for the common NoShifting/NoKernelOutput configuration.

Description

  • Add an overload of NeighborLoop! specialized for SimulationMetaData{..., NoShifting, NoKernelOutput, ...} that iterates per particle, partitions work into stable per-thread chunks, and accumulates contributions into per-thread buffers (SimThreadedArrays.dρdtIThreaded and AccelerationThreaded).
  • Implement ComputeInteractionsPerParticleNoKernel! which computes density-change and acceleration contributions between a particle pair but omits kernel-output and shifting side-effects, and returns the updated accumulators.
  • Use SimParticles.Cells, ParticleRanges, and CellDict to lookup same-cell and neighbor-cell particle ranges and perform the full stencil neighbor traversal while skipping the center cell when iterating neighbors.
  • Changes are contained in src/SPHCellList.jl (new specialized NeighborLoop! and ComputeInteractionsPerParticleNoKernel!).

Testing

  • Ran the package test command: julia --project=. -e 'using Pkg; Pkg.test()', but the run did not complete because package precompilation (UnicodePlots) stalled and the process was interrupted, so the test suite did not finish successfully.
  • No other automated tests were executed in this rollout.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant